package com.jjh.service.impl;

import com.jjh.pojo.Dishes;
import com.jjh.winterframework.annatation.Component;
import com.jjh.dao.impl.DishDaoImpl;
import com.jjh.service.DishService;
import com.jjh.util.PageBody;
import com.jjh.winterframework.annatation.Autowired;
import com.jjh.wrapper.QueryWrapper;

import java.util.Scanner;

@Component
public class DishServiceImpl implements DishService {
    private static Scanner scanner =new Scanner(System.in);
    //自己的dao
    @Autowired
    private DishDaoImpl dishDaoImpl;

    //调用订单服务
    @Autowired
    private OrderServiceImpl orderService;
    //调用用户服务
    //private UserSerice userSerice = new UserServiceImpl();

    @Override
    public PageBody pageList(int page, int size, QueryWrapper wrapper) {
        return dishDaoImpl.page(page,size,wrapper);
    }

    /**
     * 根据菜品id扣除库存
     * @param dishes
     */
    @Override
    public void removeCount(Dishes dishes,int num) {
        dishes.setNum(dishes.getNum()-num);
        dishDaoImpl.removeCount(dishes);
    }


}

